Add contribution guidelines for experimental features#867
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThis PR establishes a new experimental package with documentation and a template structure for organizing experimental optimization technique prototypes. It includes a package-level README with guidelines and requirements, an experimental module initializer that emits a stability warning, and a template directory containing example configuration, implementation, test, and usage files for new experimental techniques. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@experimental/_template/test_template.py`:
- Line 1: Update the SPDX copyright header in the new test file
(test_template.py) to reflect the correct year (change "2024" to "2026"); locate
the header line with "SPDX-FileCopyrightText" and replace the year portion so
the file's copyright year matches the creation year.
🧹 Nitpick comments (3)
experimental/_template/README.md (1)
14-18: Consider suggesting renamingtest_template.pyafter copying.Step 3 says to write tests in
test_template.py, but after copying the template toexperimental/my_technique/, the test file should ideally be renamed to match the new technique (e.g.,test_my_technique.py). A brief note would reduce confusion.experimental/_template/config.py (2)
46-51:TEMPLATE_DEFAULT_CONFIGredundantly restates field defaults.Since
TemplateConfig()with no arguments already produces identical values (all fields have defaults), this constant just duplicates information. It's fine as an illustrative template example, but a comment noting this would help contributors understand the intent is to show the pattern, not that explicit values are required.
40-43: Updateclass Configto use Pydantic v2model_configpattern for consistency with the codebase.The template currently uses the deprecated Pydantic v1-style inner
class Config. The codebase already uses the modern Pydantic v2 pattern throughout (seemodelopt/torch/opt/config.py,modelopt/torch/distill/config.py, etc.). Update to:from pydantic import BaseModel, ConfigDict, Field class TemplateConfig(BaseModel): # ... fields ... model_config = ConfigDict(validate_assignment=True)
| @@ -0,0 +1,41 @@ | |||
| # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
There was a problem hiding this comment.
Copyright year appears outdated for a newly created file.
This file is being added in 2026 but the copyright header says 2024.
-# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
🤖 Prompt for AI Agents
In `@experimental/_template/test_template.py` at line 1, Update the SPDX copyright
header in the new test file (test_template.py) to reflect the correct year
(change "2024" to "2026"); locate the header line with "SPDX-FileCopyrightText"
and replace the year portion so the file's copyright year matches the creation
year.
| ```text | ||
| experimental/my_technique/ | ||
| ├── README.md # What it does, how to use it | ||
| ├── implementation.py # Core code |
There was a problem hiding this comment.
I think we should indicate explicitly that a package of code is also allowed.
There was a problem hiding this comment.
Added one line: Organize your code as simple files or as a package
|
Overall it looks good as a start. |
1e10ee4 to
8749208
Compare
| optimized = my_optimize(model) | ||
| ``` | ||
|
|
||
| ## Status |
There was a problem hiding this comment.
can we also ask for a model support list as well?
|
|
||
| ## Requirements | ||
|
|
||
| **Must have:** |
There was a problem hiding this comment.
let's also list an up limit to lines of code for PR contributions. E.g. we cannot accept a feature that has e.g. 100k lines of change etc
|
|
||
| - Working code with clear variable names | ||
| - README explaining what it does and how to use it | ||
| - At least one test showing it works |
There was a problem hiding this comment.
I don't think this is needed for experimental
There was a problem hiding this comment.
I actually do not agree. To have an experimental feature to be put into the repo, a piece of illustration code that actually runs is necessary. However, calling it an "example" is better than a "test" in this context.
There was a problem hiding this comment.
I think this is required: README should briefly describe the optimization technique and the basic usage.
| **Optional:** | ||
|
|
||
| - Comprehensive tests | ||
| - Full documentation |
There was a problem hiding this comment.
I hope this can be required
|
|
||
| - Comprehensive tests | ||
| - Full documentation | ||
| - Pass all pre-commit checks |
There was a problem hiding this comment.
Can we also make it a requirement?
There was a problem hiding this comment.
I think pre-commit should automatically run checks on experimental code
|
|
||
| - Novel or research-stage algorithms | ||
| - Not yet production-ready | ||
| - May have unstable APIs |
There was a problem hiding this comment.
We may also not guarantee experimental features working across releases. user should be with their own to use the experimental features.
Can we also mention that user can request in github issues to promote certain features to be fully integrated so we can use that as a production readiness check.
|
|
||
| ```text | ||
| experimental/my_technique/ | ||
| ├── README.md # What it does, how to use it |
There was a problem hiding this comment.
What do we want to achieve here by enforcing a template?
IMHO, maybe a clear README.md is all we need?
There was a problem hiding this comment.
My plan is to provide a structural guideline for developers. The template might be over-engineering this. If contributors are sophisticated enough to write experimental codes, they can organize their code. I'll remove the template.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #867 +/- ##
=======================================
Coverage 73.43% 73.43%
=======================================
Files 197 197
Lines 20651 20651
=======================================
Hits 15166 15166
Misses 5485 5485 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Missing requirements.txt marking all additional dependencies than what is already there in modelopt deps
|
|
||
| ## Path to Production | ||
|
|
||
| When ready for production (proven effective, stable API, full tests, good docs), open an issue to propose graduating to the main `modelopt` package. |
There was a problem hiding this comment.
Is this experimental meant for our team or external contributors? Why not have experimental code in a separate feature branch and then merge to main when mature?
There was a problem hiding this comment.
It's for external contributors.
| - Full documentation | ||
| - Pass all pre-commit checks | ||
|
|
||
| ## Path to Production |
There was a problem hiding this comment.
I would ask the authors to provide info on deployment, e.g., any FWs supported with kernel needed.
|
|
||
| ## References | ||
|
|
||
| - Links to papers or related work |
There was a problem hiding this comment.
- code repo, project page if exist
d6bcb38 to
8d6ee43
Compare
Signed-off-by: Kai Xu <kaix@nvidia.com>
8d6ee43 to
5b61480
Compare
## What does this PR do? **Type of change:** ? <!-- Use one of the following: Bug fix, new feature, new example, new tests, documentation. --> **Overview:** ? ## Usage <!-- You can potentially add a usage example below. --> ```python # Add a code snippet demonstrating how to use this ``` ## Testing <!-- Mention how have you tested your change if applicable. --> ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes/No <!--- If No, explain why. --> - **Did you write any new necessary tests?**: Yes/No - **Did you add or update any necessary documentation?**: Yes/No - **Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**: Yes/No <!--- Only for new features, API changes, critical bug fixes or bw breaking changes. --> ## Additional Information <!-- E.g. related issue. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added comprehensive guide for experimental optimization technique development, including recommended structure, testing conventions, licensing requirements, and graduation path to production. * **New Features** * Introduced experimental package with templates and utilities for implementing research-stage optimization techniques. Includes configuration framework and example code patterns. Emits stability warnings to indicate unstable APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Kai Xu <kaix@nvidia.com>
## What does this PR do? **Type of change:** ? <!-- Use one of the following: Bug fix, new feature, new example, new tests, documentation. --> **Overview:** ? ## Usage <!-- You can potentially add a usage example below. --> ```python # Add a code snippet demonstrating how to use this ``` ## Testing <!-- Mention how have you tested your change if applicable. --> ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes/No <!--- If No, explain why. --> - **Did you write any new necessary tests?**: Yes/No - **Did you add or update any necessary documentation?**: Yes/No - **Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**: Yes/No <!--- Only for new features, API changes, critical bug fixes or bw breaking changes. --> ## Additional Information <!-- E.g. related issue. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added comprehensive guide for experimental optimization technique development, including recommended structure, testing conventions, licensing requirements, and graduation path to production. * **New Features** * Introduced experimental package with templates and utilities for implementing research-stage optimization techniques. Includes configuration framework and example code patterns. Emits stability warnings to indicate unstable APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Kai Xu <kaix@nvidia.com>
## What does this PR do? **Type of change:** ? <!-- Use one of the following: Bug fix, new feature, new example, new tests, documentation. --> **Overview:** ? ## Usage <!-- You can potentially add a usage example below. --> ```python # Add a code snippet demonstrating how to use this ``` ## Testing <!-- Mention how have you tested your change if applicable. --> ## Before your PR is "*Ready for review*" <!-- If you haven't finished some of the above items you can still open `Draft` PR. --> - **Make sure you read and follow [Contributor guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)** and your commits are signed. - **Is this change backward compatible?**: Yes/No <!--- If No, explain why. --> - **Did you write any new necessary tests?**: Yes/No - **Did you add or update any necessary documentation?**: Yes/No - **Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?**: Yes/No <!--- Only for new features, API changes, critical bug fixes or bw breaking changes. --> ## Additional Information <!-- E.g. related issue. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added comprehensive guide for experimental optimization technique development, including recommended structure, testing conventions, licensing requirements, and graduation path to production. * **New Features** * Introduced experimental package with templates and utilities for implementing research-stage optimization techniques. Includes configuration framework and example code patterns. Emits stability warnings to indicate unstable APIs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Kai Xu <kaix@nvidia.com> Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
What does this PR do?
Type of change: ?
Overview: ?
Usage
# Add a code snippet demonstrating how to use thisTesting
Before your PR is "Ready for review"
Additional Information
Summary by CodeRabbit
Documentation
New Features